﻿Public Class Form1

    Dim CSVclass As New CSV
    Dim XMLclass As New readCSV
    Dim FileHandlerClass As New FileHandler
    Dim PXMLclass As New PersonalXML
    Dim toOutlookClass As New toOutlook



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub


    Private Sub btnOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenFile.Click
        'Open een fileDialog om de .txt of .csv te openen

        tbCSV.Text = FileHandlerClass.readFile()
    End Sub

    Private Sub btnCSVtoClasses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCSVtoClasses.Click
        'Converteer de .txt of .csv file naar XML (Klassenlijst wordt tegelijkertijd gevuld)
        'XMLclass.convertToXML()
        XMLclass.readCSV()
    End Sub

    Private Sub OverToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OverToolStripMenuItem.Click
        Over.ShowDialog()
    End Sub

    Private Sub btnSaveFilePersonalXML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveFilePersonalXML.Click
        FileHandlerClass.saveFile(tbPersonalXML.Text)
    End Sub

    Private Sub btnClassesToXML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClassesToXML.Click
        PXMLclass.generatePXML()
    End Sub

    Private Sub btnOutlook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOutlook.Click
        toOutlookClass.XMLreader()

    End Sub

    Private Sub LokaalBezettingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LokaalBezettingToolStripMenuItem.Click
        Lokaal_bezetting.Show()

    End Sub

    Private Sub OnlineHelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OnlineHelpToolStripMenuItem.Click
        Try
            Process.Start("http://ab2.desheren1.nl")
        Catch ex As Exception
            MessageBox.Show("Online helpsysteem is niet beschikbaar." + vbNewLine + "Controleer uw internet verbinding.")
        End Try

    End Sub

    Private Sub GebruikershandleidingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GebruikershandleidingToolStripMenuItem.Click
        Try
            Process.Start("gebruikershandleiding.chm")
        Catch ex As Exception

        End Try

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'open een csv-bestand via internet
        If System.IO.File.Exists("csv.txt") = True Then
            System.IO.File.Delete("csv.txt")
        End If


        My.Computer.Network.DownloadFile("http://www.coolenweb.nl/csv.txt", "csv.txt")
        tbCSV.Text = FileHandlerClass.readFile("csv.txt")

        If System.IO.File.Exists("csv.txt") = True Then
            System.IO.File.Delete("csv.txt")
        End If

    End Sub

    Private Sub btnOpenFilePersonalXML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenFilePersonalXML.Click
        tbPersonalXML.Text = FileHandlerClass.readXMLFile()
    End Sub
End Class
